package j01string;

import java.util.Arrays;

public class J1 {
    public static void main(String[] args) {
        System.out.println("a_b_c_d".replace('_','X'));
        String s;
        System.out.println("a_b_c_d".replace("_","XY"));
        System.out.println("=====");
        /*
        爱好，苹果,葡萄，香蕉
        ｛苹果,葡萄，香蕉｝
         */
        String likeStr = "苹果,w葡萄,w香蕉";
        String[] likeArr = likeStr.split(",w");
        System.out.println(Arrays.toString(likeArr));

        String str2 = "abcde";
        String[] arr2 = str2.split("");
        System.out.println(Arrays.toString(arr2));
        System.out.println(">>>>>>");
        System.out.println(String.join("_$","aa","bb","cc"));
        System.out.println(String.join(",",new String[]{"aa","mm","ff"}));
    }
}

class J2{
    public static void main(String[] args) {
        String s1 = "abcdefg";
        //不要最后一个下标
        System.out.println(s1.substring(0,2));
        System.out.println(s1.substring(2,4));//cd
        System.out.println(s1.substring(3));//后面的全部截取

        System.out.println("aBc".toLowerCase());
        System.out.println("aBc".toUpperCase());

        System.out.println("  a  b  c    ".trim());
        //admin

        String s2 = String.valueOf(4);
        String s3 = 4+"";
    }
}
